package org.whuims.pois.model;

import org.apache.struts.action.ActionForm;
import org.whuims.pois.hibernate.BaseDao;

import javax.persistence.*;

/**
 * Created by zhongwei on 2014/5/13.
 */
@Entity
@Table(name = "spider_c")
public class SpiderC extends ActionForm {
    static BaseDao baseDao = new BaseDao();
    private long id;
    private String name;
    private long site;
    private String sitename;
    private Integer crawlertype;
    private Integer pausetype;
    private String pauseextras;
    private Integer interval;
    private Integer limitdatetype;
    private String limitdateextras;
    private String urlParams;
    private String entryUrls;
    private int status;
    private long topicId;
    private String dType;   //数据类型

    public SpiderC() {
    }

    @Basic
    @Column(name = "topic")
    public long getTopicId() {
        return topicId;
    }

    public void setTopicId(long topicId) {
        this.topicId = topicId;
    }

    @Id
    @Column(name = "id")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "pname")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "site")
    public long getSite() {
        return site;
    }

    public void setSite(long site) {
        this.site = site;
    }

    @Basic
    @Column(name = "sitename")
    public String getSitename() {
        return sitename;
    }

    public void setSitename(String sitename) {
        this.sitename = sitename;
    }

    @Basic
    @Column(name = "crawlertype")
    public Integer getCrawlertype() {
        return crawlertype;
    }

    public void setCrawlertype(Integer crawlertype) {
        this.crawlertype = crawlertype;
    }

    @Basic
    @Column(name = "pausetype")
    public Integer getPausetype() {
        return pausetype;
    }

    public void setPausetype(Integer pausetype) {
        this.pausetype = pausetype;
    }

    @Basic
    @Column(name = "pauseextras")
    public String getPauseextras() {
        return pauseextras;
    }

    public void setPauseextras(String pauseextras) {
        this.pauseextras = pauseextras;
    }

    @Basic
    @Column(name = "pinterval")
    public Integer getInterval() {
        return interval;
    }

    public void setInterval(Integer interval) {
        this.interval = interval;
    }

    @Basic
    @Column(name = "limitdatetype")
    public Integer getLimitdatetype() {
        return limitdatetype;
    }

    public void setLimitdatetype(Integer limitdatetype) {
        this.limitdatetype = limitdatetype;
    }

    @Basic
    @Column(name = "limitdateextras")
    public String getLimitdateextras() {
        return limitdateextras;
    }

    public void setLimitdateextras(String limitdateextras) {
        this.limitdateextras = limitdateextras;
    }

    @Basic
    @Column(name = "urlParams")
    public String getUrlParams() {
        return urlParams;
    }

    public void setUrlParams(String urlParams) {
        this.urlParams = urlParams;
    }

    @Basic
    @Column(name = "entryUrls")
    public String getEntryUrls() {
        return entryUrls;
    }

    public void setEntryUrls(String entryUrls) {
        this.entryUrls = entryUrls;
    }

    @Basic
    @Column(name = "status")
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Basic
    @Column(name = "ptype")
    public String getdType() {
        return dType;
    }

    public void setdType(String dType) {
        this.dType = dType;
    }

    public SpiderC(String name, long site, String sitename, Integer crawlertype, Integer pausetype, String pauseextras, Integer interval, String limitdateextras, Integer limitdatetype, String entryUrls, String urlParams, int status, long topicId) {
        this.name = name;
        this.site = site;
        this.sitename = sitename;
        this.crawlertype = crawlertype;
        this.pausetype = pausetype;
        this.pauseextras = pauseextras;
        this.interval = interval;
        this.limitdateextras = limitdateextras;
        this.limitdatetype = limitdatetype;
        this.entryUrls = entryUrls;
        this.urlParams = urlParams;
        this.status = status;
        this.topicId = topicId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SpiderC spiderC = (SpiderC) o;

        if (id != spiderC.id) return false;
        if (site != spiderC.site) return false;
        if (crawlertype != null ? !crawlertype.equals(spiderC.crawlertype) : spiderC.crawlertype != null) return false;
        if (entryUrls != null ? !entryUrls.equals(spiderC.entryUrls) : spiderC.entryUrls != null) return false;
        if (interval != null ? !interval.equals(spiderC.interval) : spiderC.interval != null) return false;
        if (limitdateextras != null ? !limitdateextras.equals(spiderC.limitdateextras) : spiderC.limitdateextras != null)
            return false;
        if (limitdatetype != null ? !limitdatetype.equals(spiderC.limitdatetype) : spiderC.limitdatetype != null)
            return false;
        if (name != null ? !name.equals(spiderC.name) : spiderC.name != null) return false;
        if (pauseextras != null ? !pauseextras.equals(spiderC.pauseextras) : spiderC.pauseextras != null) return false;
        if (pausetype != null ? !pausetype.equals(spiderC.pausetype) : spiderC.pausetype != null) return false;
        if (sitename != null ? !sitename.equals(spiderC.sitename) : spiderC.sitename != null) return false;
        if (urlParams != null ? !urlParams.equals(spiderC.urlParams) : spiderC.urlParams != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (int) (site ^ (site >>> 32));
        result = 31 * result + (sitename != null ? sitename.hashCode() : 0);
        result = 31 * result + (crawlertype != null ? crawlertype.hashCode() : 0);
        result = 31 * result + (pausetype != null ? pausetype.hashCode() : 0);
        result = 31 * result + (pauseextras != null ? pauseextras.hashCode() : 0);
        result = 31 * result + (interval != null ? interval.hashCode() : 0);
        result = 31 * result + (limitdatetype != null ? limitdatetype.hashCode() : 0);
        result = 31 * result + (limitdateextras != null ? limitdateextras.hashCode() : 0);
        result = 31 * result + (urlParams != null ? urlParams.hashCode() : 0);
        result = 31 * result + (entryUrls != null ? entryUrls.hashCode() : 0);
        return result;
    }
//    public static void main(String[] args){
//
//        SpiderC spider = new SpiderC(null,4,null,1,0,null,null,null,0,"33","22",0,0);
//        baseDao.create(spider);
//    }
}
